package com.sdhs.system.service.impl;

import java.util.List;

import com.sdhs.system.service.IMessageInfoReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sdhs.common.utils.DateUtils;
import com.sdhs.common.utils.SecurityUtils;
import com.sdhs.system.domain.dto.MessageInfoReadDTO;
import com.sdhs.system.domain.vo.MessageInfoReadVO;
import com.sdhs.system.mapper.MessageInfoReadMapper;

/**
 * 消息阅读记录Service业务层处理
 *
 * @author mz
 * @date 2023-09-11
 */
@Service
public class MessageInfoReadServiceImpl implements IMessageInfoReadService {
    @Autowired
    private MessageInfoReadMapper messageInfoReadMapper;

    /**
     * 查询消息阅读记录
     *
     * @param id 消息阅读记录主键
     * @return 消息阅读记录
     */
    @Override
    public MessageInfoReadVO selectMessageInfoReadById(Long id) {
        return messageInfoReadMapper.selectMessageInfoReadById(id);
    }

    /**
     * 查询消息阅读记录列表
     *
     * @param messageInfoReadDTO 消息阅读记录
     * @return 消息阅读记录
     */
    @Override
    public List<MessageInfoReadVO> selectMessageInfoReadList(MessageInfoReadDTO messageInfoReadDTO) {
        return messageInfoReadMapper.selectMessageInfoReadList(messageInfoReadDTO);
    }

    /**
     * 新增消息阅读记录
     *
     * @param messageInfoReadDTO 消息阅读记录
     * @return 结果
     */
    @Override
    public int insertMessageInfoRead(MessageInfoReadDTO messageInfoReadDTO) {
    	messageInfoReadDTO.setCreateBy(SecurityUtils.getUsername());
        messageInfoReadDTO.setCreateTime(DateUtils.getNowDate());
        return messageInfoReadMapper.insertMessageInfoRead(messageInfoReadDTO);
    }

    /**
     * 修改消息阅读记录
     *
     * @param messageInfoReadDTO 消息阅读记录
     * @return 结果
     */
    @Override
    public int updateMessageInfoRead(MessageInfoReadDTO messageInfoReadDTO) {
    	messageInfoReadDTO.setUpdateBy(SecurityUtils.getUsername());
        messageInfoReadDTO.setUpdateTime(DateUtils.getNowDate());
        return messageInfoReadMapper.updateMessageInfoRead(messageInfoReadDTO);
    }

    /**
     * 批量删除消息阅读记录
     *
     * @param ids 需要删除的消息阅读记录主键
     * @return 结果
     */
    @Override
    public int deleteMessageInfoReadByIds(Long[] ids) {
        return messageInfoReadMapper.deleteMessageInfoReadByIds(ids);
    }

    /**
     * 删除消息阅读记录信息
     *
     * @param id 消息阅读记录主键
     * @return 结果
     */
    @Override
    public int deleteMessageInfoReadById(Long id) {
        return messageInfoReadMapper.deleteMessageInfoReadById(id);
    }
}
